package com.jpf.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jpf.demo.Order;
import com.jpf.service.OrderService;
@WebServlet("/AlterOrder.do")
public class AlterOrder extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		response.setContentType("text/html;charset=utf-8");
		request.setCharacterEncoding("utf-8");
		PrintWriter out = response.getWriter();
		OrderService orderService = new OrderService();
		int oid =Integer.parseInt(request.getParameter("oid"));
		//System.out.print(oid);
		Order order=orderService.queryOrder(oid);
		if (orderService.updateOrder(order))
			response.sendRedirect("QueryOrder.do");
		else response.sendRedirect("admin/error.jsp");
	}

}
